#ifndef MAINAPPLICATION_H
#define MAINAPPLICATION_H

#include "stdafx.h"
#include "BaseApplication.h"

class MainApplication : public BaseApplication
{
public:
    MainApplication(void);
    virtual ~MainApplication(void);

private:
	virtual void setLight(void);
	virtual void setStaticPlane(void);
	virtual void setRobot(void);
	virtual void setCamera(void);

protected:
    virtual void createScene(void);
	virtual void createFrameListener(void);
	virtual bool frameRenderingQueued(const Ogre::FrameEvent& evt);
	virtual bool frameStarted(const Ogre::FrameEvent& evt);
	virtual bool frameEnded(const Ogre::FrameEvent& evt);

	virtual bool keyPressed( const OIS::KeyEvent&);
	virtual bool MainApplication::keyReleased( const OIS::KeyEvent&);

	Ogre::Entity* robotEntity;
	Ogre::SceneNode* robotNode;
	Ogre::Entity* tableEntity;
	Ogre::SceneNode* tableNode;
	OgreBulletDynamics::RigidBody *robotBody;

	//Bullet
	OgreBulletDynamics::DynamicsWorld *mWorld;	// OgreBullet World
 	OgreBulletCollisions::DebugDrawer *debugDrawer;

private:
    OgreBulletDynamics::WheeledRigidBody        *mCarChassis;
    OgreBulletDynamics::VehicleTuning	        *mTuning;
    OgreBulletDynamics::VehicleRayCaster	    *mVehicleRayCaster;
    OgreBulletDynamics::RaycastVehicle	        *mVehicle;

    Ogre::Entity    *mChassis;
    Ogre::Entity    *mWheels[4];
    Ogre::SceneNode *mWheelNodes[4];


    int mWheelsEngine[2];
    int mWheelsEngineCount;

	int mWheelsSteerable[2];
    int mWheelsSteerableCount;

    float mEngineForce;
    float mSteering;

    bool mSteeringLeft;
    bool mSteeringRight;

};

#endif
